{% set label = lineItem.label|trans|sw_sanitize %}
{% set label = label !== '' ? label : lineItem.label %}

{% if displayMode is not defined %}
    {% set displayMode = 'default' %}
{% endif %}

{% if showRemoveButton is not defined %}
    {% set showRemoveButton = true %}
{% endif %}

{% if showSubtotal is not defined %}
    {% set showSubtotal = true %}
{% endif %}

{% set lineItemClasses = 'line-item line-item-' ~ lineItem.type ~ ' is-' ~ displayMode %}

{% if displayMode === 'offcanvas' %}
    {% set lineItemClasses = lineItemClasses ~ ' js-cart-item' %}
{% endif %}

{% if not showRemoveButton %}
    {% set lineItemClasses = lineItemClasses ~ ' no-remove-button' %}
{% endif %}

{% if not showSubtotal %}
    {% set lineItemClasses = lineItemClasses ~ ' no-summary' %}
{% endif %}

{% block component_line_item_type_product %}
    <li class="{{ lineItemClasses }}">

        {% block component_line_item_type_product_inner %}
            {% block component_line_item_type_product_row %}
                <div class="row line-item-row">
                    {% block component_line_item_type_product_row_inner %}
                        {% block component_line_item_type_product_col_info %}
                            <div class="line-item-info">
                                {% block component_line_item_type_product_info_row %}
                                    <div class="row line-item-row">
                                        {% set showLineItemModal = activeRoute is same as('frontend.checkout.confirm.page') %}

                                        {% if nestingLevel < 1 %}
                                            {% block component_line_item_type_product_image %}
                                                <div class="col-auto line-item-info-img">
                                                    <div class="line-item-img-container">
                                                        {% block component_line_item_type_product_image_inner %}
                                                            {% sw_include '@Storefront/storefront/component/line-item/element/image.html.twig' with {
                                                                lineItemLink: displayMode !== 'order' or lineItem.productId ? seoUrl('frontend.detail.page', { productId: lineItem.referencedId }) : null,
                                                                lineItemModalLink: showLineItemModal ? path('widgets.quickview.minimal', { productId: lineItem.referencedId }) : false,
                                                            } %}
                                                        {% endblock %}
                                                    </div>
                                                </div>
                                            {% endblock %}
                                        {% endif %}

                                        {% block component_line_item_type_product_details %}
                                            <div class="line-item-details">
                                                {% block component_line_item_type_product_details_container %}
                                                    <div class="line-item-details-container">
                                                    {% block component_line_item_type_product_label %}
                                                        {% sw_include '@Storefront/storefront/component/line-item/element/label.html.twig' with {
                                                            lineItemLink: displayMode !== 'order' or lineItem.productId ? seoUrl('frontend.detail.page', { productId: lineItem.referencedId }) : null,
                                                            lineItemModalLink: showLineItemModal ? path('widgets.quickview.minimal', { productId: lineItem.referencedId }) : false,
                                                        } %}
                                                    {% endblock %}

                                                    {% if lineItem.payload.options is not empty %}
                                                        {% block component_line_item_type_product_variant_characteristics %}
                                                            {% sw_include '@Storefront/storefront/component/line-item/element/variant-characteristics.html.twig' %}
                                                        {% endblock %}
                                                    {% endif %}

                                                    {% if lineItem.payload.features is not empty %}
                                                        {% block component_line_item_type_product_features %}
                                                            {% sw_include '@Storefront/storefront/component/product/feature/list.html.twig' with {
                                                                features: lineItem.payload.features
                                                            } %}
                                                        {% endblock %}
                                                    {% endif %}

                                                    {% if lineItem.payload.productNumber %}
                                                        {% block component_line_item_type_product_number %}
                                                            <div class="line-item-product-number">
                                                                {{ 'checkout.cartItemInfoId'|trans|sw_sanitize }} {{ lineItem.payload.productNumber }}
                                                            </div>
                                                        {% endblock %}
                                                    {% endif %}

                                                    {% if config('core.cart.showDeliveryTime') %}
                                                        {% block component_line_item_type_product_delivery_date %}
                                                            {% sw_include '@Storefront/storefront/component/line-item/element/delivery-date.html.twig' %}
                                                        {% endblock %}
                                                    {% endif %}

                                                    {% if config('core.cart.wishlistEnabled') %}
                                                        {% block component_line_item_type_product_wishlist %}
                                                            {% sw_include '@Storefront/storefront/component/product/card/wishlist.html.twig' with {
                                                                showText: true,
                                                                size: 'sm',
                                                                productId: lineItem.referencedId
                                                            } %}
                                                        {% endblock %}
                                                    {% endif %}
                                                </div>
                                                {% endblock %}
                                            </div>
                                        {% endblock %}
                                    </div>
                                {% endblock %}
                            </div>
                        {% endblock %}

                        {% block component_line_item_type_product_col_quantity %}
                            <div class="line-item-quantity">
                                {% sw_include '@Storefront/storefront/component/line-item/element/quantity.html.twig' %}
                            </div>
                        {% endblock %}

                        {% if showTaxPrice %}
                            {% block component_line_item_type_product_col_tax_price %}
                                <div class="line-item-tax-price">
                                    {% if context.salesChannel.taxCalculationType == 'horizontal' %}
                                        {% sw_include '@Storefront/storefront/component/line-item/element/tax-price.html.twig' %}
                                    {% endif %}
                                </div>
                            {% endblock %}
                        {% else %}
                            {% block component_line_item_type_product_col_unit_price %}
                                <div class="line-item-unit-price{% if lineItem.quantity > 1 %} is-shown{% endif %}">
                                    {% sw_include '@Storefront/storefront/component/line-item/element/unit-price.html.twig' %}
                                </div>
                            {% endblock %}
                        {% endif %}

                        {% if showSubtotal %}
                            {% block component_line_item_type_product_col_total_price %}
                                <div class="line-item-total-price line-item-price">
                                    {% sw_include '@Storefront/storefront/component/line-item/element/total-price.html.twig' with {
                                        currency: lineItem.order.currency.isoCode
                                    } %}
                                </div>
                            {% endblock %}
                        {% endif %}

                        {% if showRemoveButton %}
                            {% block component_line_item_type_product_col_remove %}
                                <div class="line-item-remove">
                                    {% if lineItem.removable and nestingLevel < 1 %}
                                        {% sw_include '@Storefront/storefront/component/line-item/element/remove.html.twig' %}
                                    {% endif %}
                                </div>
                            {% endblock %}
                        {% endif %}
                    {% endblock %}
                </div>
            {% endblock %}

            {% if displayMode === 'order' %}
                {% block component_line_item_type_product_downloads_table %}
                    <div class="order-detail-content-list">
                        {% sw_include '@Storefront/storefront/component/line-item/element/downloads.html.twig' %}
                    </div>
                {% endblock %}
            {% endif %}
        {% endblock %}
    </li>
{% endblock %}
